﻿<?php
  @header("content-Type: text/html; charset=utf-8"); //语言强制
  
  $specialTitle = '社保基金买了什么股';  
  
	require_once('head.php');
?>

<br/><br/>

<link rel="stylesheet" href="/css/table.css" type="text/css"/>

<table class="t1"> 
<thead><th>股票代码</th><th>股票名称</th><th>股东</th><th>占股数量</th><th>占股比例</th></thead>
 
<?php
  // Connect to the database 
  $dbc = mysqli_connect('localhost', 'root', 'k00l@1D;', 'gudahu')
    or die('Error connecting to MySQL server.');
	mysqli_set_charset($dbc, 'utf8');
  // Retrieve the score data from MySQL
  
$query = "select th.stock_code, s.name, th.holder_name, th.share_amount, th.share_ratio FROM top_holder th inner join stock s on th.stock_code = s.code where th.appear_date = '2013-03-31' and th.holder_name like '%社保基金%' order by th.share_ratio desc";
  $result = mysqli_query($dbc, $query)
    or die('Error querying database.');
    
  $isLine2 = false;
  $seq = 1;
  while ($row = mysqli_fetch_array($result)) {   	  
  	  if ($isLine2) {
  	  	echo '<tr class="a1">';
  	  	$isLine2 = false;
  	  } else {
  	  	echo '<tr>';
  	  	$isLine2 = true;
  	  }
  	  
      echo '<td><a target="_blank" href="http://www.gudahu.com/topHolderDetail.php?code='.$row['stock_code'].'">'.$row['stock_code'].'</a></td>';
      echo '<td>'.$row['name'].'</td>';
      echo '<td>'.$row['holder_name'].'</td>';
      echo '<td>'.$row['share_amount'].'</td>';
      echo '<td>'.$row['share_ratio'].'%</td>';
      echo '</tr>';
      $seq++;
  }	
  				    
  mysqli_close($dbc);
?>

</table>

<br/><br/>

<style>
#index {
	font-family: "宋体", Arial, Verdana, sans-serif, Helvetica;
	width: 80%;
	border-collapse: collapse;
}

#index td,#index th {
	font-size: 12px;
	border: 1px solid #98bf21;
	padding: 3px 7px 2px 7px;
}

#index th {
	font-size: 12px;
	text-align: center;
	padding-top: 5px;
	padding-bottom: 4px;
	background: url(../images/header_bei.gif);
	color: #000000;
}

#index tr.alt td {
	background-color: #ffffff;
	color: #000000;
}

#index tr.alt1 td {
	background-color: #f4f5eb;
	color: #000000;
}
</style>

<script type="text/javascript" language="javascript"
	src="js/jquery-1.5.min.js"></script>
<script type="text/javascript" language="javascript"
	src="js/jquery.table.js"></script>
	
<div style="margin: 0 auto; text-align: center">

<table id="index" align="center">
	<thead>
		<tr>
			<th class="js-OrderByNum">序号</th>
			<th class="js-OrderByPort">社保基金组合</th>
			<th class="js-OrderByShort">社保基金组合缩写</th>
			<th class="js-OrderByAdmin">基金管理人</th>
			<th class="js-OrderByOrie">投资方向</th>
		</tr>
	</thead>
	<tbody>
	
<?php
  // Connect to the database 
  $dbc = mysqli_connect('localhost', 'root', 'k00l@1D;', 'gudahu')
    or die('Error connecting to MySQL server.');
	mysqli_set_charset($dbc, 'utf8');
  // Retrieve the score data from MySQL
  
  $query = "SELECT os.id, os.portfolio_code, os.short_portfolio_code, os.admin_org, os.invest_orientation from org_shebao os";
  $result = mysqli_query($dbc, $query)
    or die('Error querying database.');
  $seq = 0;
  $rowClass = 'alt';  

  while ($row = mysqli_fetch_array($result)) { 
		  if (($seq ++) % 2 == 0) {
		      $rowClass = 'alt'; 
		  } else {
		      $rowClass = 'alt1';
		  } 
		  echo "<tr class='".$rowClass."' style='display: table-row;'>";
		  echo "<td class='js-Num'>".$row['id']."</td>";
		  echo "<td class='js-Port'>".$row['portfolio_code']."</td>";  
		  echo "<td class='js-Short'><a target='_blank' href='http://www.gudahu.com/hotKeyword.php?keyword=".$row['short_portfolio_code']."'>".$row['short_portfolio_code']."</a></td>";		  
		  echo "<td class='js-Admin'>".$row['admin_org']."</td>";  
		  echo "<td class='js-Orie'>".$row['invest_orientation']."</td>";  
		  echo "</tr>"; 
  }
  mysqli_close($dbc);
?>
			
	</tbody>
</table>

<script language="javascript" type="text/javascript">
	var tableElement = $("#index");
	var currentPageSize = 100;
	if (tableElement != null) {
		tableElement.tablePaging({
			pageSize : currentPageSize,
			sorting : true,
			sortSelector : ".js-Num",
			sortType : "number"
		});
		$(".js-OrderByDate").click(function() {
			tableElement.tablePaging({
				pageSize : currentPageSize,
				sorting : true,
				sortSelector : ".js-Port",
				sortType : "string"
			});
		});
		$(".js-OrderByCode").click(function() {
			tableElement.tablePaging({
				pageSize : currentPageSize,
				sorting : true,
				sortSelector : ".js-Short",
				sortType : "string"
			});
		});
		$(".js-OrderByName").click(function() {
			tableElement.tablePaging({
				pageSize : currentPageSize,
				sorting : true,
				sortSelector : ".js-Admin",
				sortType : "string"
			});
		});
		$(".js-OrderByRsi").click(function() {
			tableElement.tablePaging({
				pageSize : currentPageSize,
				sorting : true,
				sortSelector : ".js-Orie",
				sortType : "string"
			});
		});
	}
</script>

</div>

<br/><br/>

<?php
	require_once('foot.php');
?>  